﻿@{
    ViewBag.Title = "MemberReWord";
    Layout = "~/Views/Shared/_Form.cshtml";
}
<script>
    function submitForm() {
        var result=checkUser();
        if(result!=""){
            $.modalMsg(result,"warning");
            return false;
        }
        var atype=$('input:radio:checked').val();
        var aold=$("#F_OldPassword").val();
        var anewpass=$("#F_NewPassword").val();
        $.submitForm({
            url: "/SystemManage/User/SubmitRePassword?type="+atype+"&old="+aold+"&newpass="+anewpass,
            success: function () {
                $.loading(false)
            }
        });
    }
    function checkUser(){
        var P=$("#F_NewPassword").val();
        var P1=$("#F_Password").val();
        var Pnumasc = 0;
        var Pcharasc = 0;
        if(0==P.length){
            return "密码不能为空";
        }else if(P.length<6||P.length>9){
            return "密码长度应为长度6-9位";
        }else{
            for (var i = 0; i < P.length; i++) {
                var asciiNumber = P.substr(i, 1).charCodeAt();
                if (asciiNumber >= 48 && asciiNumber <= 57) {
                    Pnumasc += 1;
                }
                if ((asciiNumber >= 65 && asciiNumber <= 90)||(asciiNumber >= 97 && asciiNumber <= 122)) {
                    Pcharasc += 1;
                }
            }
            if(0==Pnumasc)  {
                return "密码必须含有数字";
            }else if(0==Pcharasc){
                return "密码必须含有字母";
            }else if(P!=P1){
                return "密码两次输入的不一致";
            }else{
                return "";
            }
            
        }
    }
</script>
<form id="form1">
    <div style="padding-top: 30px; margin-right: 40px;">
        <table class="form">
            <tr>
                <th class="formTitle">密码类型</th>
                <td class="formValue">
                    登录密码&nbsp;&nbsp;&nbsp;&nbsp;<input type="radio" name="type" id="pwd" checked value="pwd"/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                    交易密码&nbsp;&nbsp;&nbsp;&nbsp;<input type="radio" name="type" id="pwd1" value="pwd1" />
                </td>
            </tr>
            <tr>
                <th class="formTitle">旧密码</th>
                <td class="formValue">
                    <input id="F_OldPassword" name="F_RealName" type="password" class="form-control required"  placeholder="请输入旧密码"/>
                </td>
            </tr>
            <tr>
                <th class="formTitle">新密码</th>
                <td class="formValue">
                    <input id="F_NewPassword" name="F_UserPassword" type="password" class="form-control required" placeholder="请输入新密码" />
                </td>
            </tr>
            <tr>
                <th class="formTitle">确认密码</th>
                <td class="formValue">
                    <input id="F_Password" name="F_UserPassword" type="password" class="form-control required" placeholder="请再次输入新密码" />
                </td>
            </tr>
        </table>
    </div>
</form>
